﻿<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true"
    CodeFile="Article.aspx.cs" Inherits="Admin_Article" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:Label ID="lblScripts" runat="server" Text=""></asp:Label>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    <data:GridViewSearchPanel ID="GridViewSearchPanel1" runat="server" GridViewControlID="GridView1"
        PersistenceMethod="Session" LookForText="Tìm trong" WhichText="Chọn loại" />
    <br />
    <data:EntityGridView ID="GridView1" runat="server" AutoGenerateColumns="False" ShowGridOnEmptyData="false"
        OnSelectedIndexChanged="GridView1_SelectedIndexChanged" OnRowCommand="GridView1_RowCommand"
        DataSourceID="ArticleDataSource" DataKeyNames="Id" RecordsPerPageText="Số bài"
        PageSelectorPageSizeInterval="10" RecordsCount="0" ShowPageText="Trang" TotalRecordsText="Tổng số"
        DefaultSortColumnName="DateCreate" DefaultSortDirection="Descending" AllowMultiColumnSorting="false"
        AllowExportToExcel="false" AllowPaging="true" AllowSorting="true">
        <Columns>
            <asp:BoundField DataField="OriginalId" HeaderText="Original Id" SortExpression="[OriginalId]"
                Visible="false" />
            <asp:BoundField DataField="Title" HeaderText="Tiêu đề" SortExpression="[Title]" />
            <asp:BoundField DataField="Alias" HeaderText="Alias" SortExpression="[Alias]" Visible="false" />
            <asp:BoundField DataField="Intro" HeaderText="Intro" SortExpression="[Intro]" Visible="false" />
            <asp:BoundField DataField="MainContent" HeaderText="Main Content" SortExpression=""
                Visible="false" />
            <asp:BoundField DataField="LinkImage" HeaderText="Link Image" SortExpression="[LinkImage]"
                Visible="false" />
            <asp:BoundField DataField="MenuId" HeaderText="Menu Id" SortExpression="[MenuId]"
                Visible="false" />
            <asp:BoundField DataField="MenuTitle" HeaderText="Chuyên mục" SortExpression="[MenuTitle]" />
            <asp:BoundField DataField="MenuAlias" HeaderText="Menu Alias" SortExpression="[MenuAlias]"
                Visible="false" />
            <asp:BoundField DataField="MenuLink" HeaderText="Menu Link" SortExpression="[MenuLink]"
                Visible="false" />
            <asp:BoundField DataField="Language" HeaderText="Language" SortExpression="[Language]"
                Visible="false" />
            <asp:TemplateField ItemStyle-Width="45" HeaderText="Hiển thị" SortExpression="[IsDisabled]">
                <ItemTemplate>
                    <asp:Label ID="lblIsDisabled" runat="server" Text='<%# (Boolean)Eval("IsDisabled")?"Không":"Có"%>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="20">
                <ItemTemplate>
                    <asp:ImageButton ID="btnDisable" runat="server" CommandName="CustomDisable" CommandArgument='<%#Eval("Id") %>'
                        ImageUrl='<%# (Boolean)Eval("IsDisabled")?"~/Admin/Skin/Resources/images/icons/tick_circle.png":"~/Admin/Skin/Resources/images/icons/cross_circle.png" %>'
                        OnClientClick='<%# !(Boolean)Eval("IsDisabled")?"return confirm(" + Server.HtmlDecode("&#39;") + "Bạn muốn tắt bài viết này?" + Server.HtmlDecode("&#39;") + ");":"return confirm(" + Server.HtmlDecode("&#39;") + "Bạn muốn mở bài viết này?" + Server.HtmlDecode("&#39;") + ");" %>'
                        ToolTip='<%# (Boolean)Eval("IsDisabled")?"Mở bài viết":"Tắt bài viết"%>' />
                </ItemTemplate>
            </asp:TemplateField>
            <data:BoundRadioButtonField DataField="IsDisabled" HeaderText="Is Disabled" SortExpression="[IsDisabled]"
                Visible="false" />
            <data:BoundRadioButtonField DataField="IsRemoved" HeaderText="Is Removed" SortExpression="[IsRemoved]"
                Visible="false" />
            <asp:BoundField DataField="DatePublish" DataFormatString="{0:HH:mm dd/MM/yyyy}" HtmlEncode="False"
                HeaderText="Ngày đăng" SortExpression="[DatePublish]" ItemStyle-Width="120" />
            <asp:BoundField DataField="DateCreate" DataFormatString="{0:HH:mm dd/MM/yyyy}" HtmlEncode="False"
                HeaderText="Ngày tạo" SortExpression="[DateCreate]" ItemStyle-Width="120" />
            <asp:BoundField DataField="UserCreate" HeaderText="User Create" SortExpression="[UserCreate]"
                Visible="false" />
            <asp:BoundField DataField="DateModify" DataFormatString="{0:d}" HtmlEncode="False"
                HeaderText="Date Modify" SortExpression="[DateModify]" Visible="false" />
            <asp:BoundField DataField="UserModify" HeaderText="User Modify" SortExpression="[UserModify]"
                Visible="false" />
            <asp:CommandField ShowSelectButton="True" SelectText="Sửa" SelectImageUrl="~/Admin/Skin/Resources/images/icons/pencil.png" ShowEditButton="false"
                ItemStyle-Width="30" Visible="false" />
            <asp:TemplateField ItemStyle-Width="60">
                <ItemTemplate>
                    <asp:ImageButton ID="btnEdit" runat="server" CommandName="CustomEdit" CommandArgument='<%#Eval("Id") %>'
                        ImageUrl="~/Admin/Skin/Resources/images/icons/pencil.png"
                        ToolTip="Sửa" />
                    <asp:ImageButton ID="btnDelete" runat="server" CommandName="CustomDelete" CommandArgument='<%#Eval("Id") %>'
                        ImageUrl="~/Admin/Skin/Resources/images/icons/cross.png"
                        OnClientClick="return confirm('Bạn muốn xóa bài viết này?');" ToolTip="Xóa" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <b>Chưa có bài viết</b>
        </EmptyDataTemplate>
    </data:EntityGridView>
    <br />
    <asp:Button runat="server" ID="btnArticle" OnClientClick="javascript:location.href='ArticleEdit.aspx'; return false;"
        Text="Thêm bài viết" CssClass="button"></asp:Button>
    <data:ArticleDataSource ID="ArticleDataSource" runat="server" SelectMethod="GetPaged"
        EnablePaging="True" EnableSorting="True">
        <Parameters>
            <data:CustomParameter Name="WhereClause" Value="" ConvertEmptyStringToNull="false" />
            <data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" />
            <asp:ControlParameter Name="PageIndex" ControlID="GridView1" PropertyName="PageIndex"
                Type="Int32" />
            <asp:ControlParameter Name="PageSize" ControlID="GridView1" PropertyName="PageSize"
                Type="Int32" />
            <data:CustomParameter Name="RecordCount" Value="0" Type="Int32" />
        </Parameters>
    </data:ArticleDataSource>
</asp:Content>
